﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 降低每帧调用物理来提高性能
/// </summary>
public class 模拟物理 : MonoBehaviour
{
    public float 物理步骤 = 0.1f;
    public float 帧时间 = 0.1f;


    //对2d物理无效
    private void Start()
    {
        StartCoroutine(携程());
    }

    private IEnumerator 携程()
    {
        while (true)
        {
            Physics.Simulate(物理步骤);
            yield return new WaitForSeconds(物理步骤);
        }
    }
}
